# 列表推导式
l1 = [i for i in range(10)]
print(type(l1), l1.__sizeof__())  # <class 'list'> 168

# 生成器表达式
l2 = (i for i in range(10))
print(type(l2), l2.__sizeof__())   # <class 'generator'> 96

# 循环列表
for i in l1:
    print(i)

print("-" * 30)
# 循环生成器
for i in l2:
    print(i)